remote: Minor argument parsing cleanup
authorColin Walters <walters@verbum.org>
Sat, 21 Jun 2014 16:11:56 +0000 (12:11 -0400)
committerColin Walters <walters@verbum.org>
Sat, 21 Jun 2014 19:57:43 +0000 (15:57 -0400)
Only access relevant portion of argv after we've verified argc.

https://bugzilla.gnome.org/show_bug.cgi?id=731984

src/ostree/ot-builtin-remote.c

index 75abc5596b3c86d2f73df13953d67a46488c6ecc..3a9c3b74f731b43f8110f5fd713808d6794d3dff 100644 (file)
@@ -98,7 +98,7 @@ ostree_builtin_remote (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
 
   if (!strcmp (op, "add"))
     {
-      const char *url = argv[3];
+      const char *url;
       char **iter;
       gs_free char *target_name = NULL;
       gs_unref_object GFile *target_conf = NULL;
@@ -110,6 +110,8 @@ ostree_builtin_remote (int argc, char **argv, OstreeRepo *repo, GCancellable *ca
           goto out;
         }
 
+      url = argv[3];
+
       optbuilder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"));
 
       if (argc > 4)